<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>文件上传</title>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript">
	$(function() {
		/*图片上传*/
		$("#bImgUpd").click(function() {
			var formData = new FormData();
			var ImgUpdArr = $("#TSK_ATT")[0].files;
			for (var i = 0; i < ImgUpdArr.length; i++) {
				formData.append("TSK_ATT", ImgUpdArr[i]);
			}
			
			$.ajax({
				url:"/file/upload",
				type:"POST",
				data:formData,
				processData: false,
				contentType: false,
				success:function(data) {
					if(data.cod == "200") {
						$("#divUpdRes").html("上传成功");
					}
				}
			});
			
		});
		
		/*图片预览*/
		$(".cFilUpd").change(function() {
			var ImgArr = $(this)[0].files;
			var ImgPreStr = "<ul style=\"list-style:none;width:50px;\">";
			for (var i = 0; i < ImgArr.length; i++) {
				var url = URL.createObjectURL(ImgArr[i]);
				ImgPreStr += "<li style=\"float:left;\"><img src=\"" + url + "\" style=\"width:40px;\" /></li>"; 
			}
			ImgPreStr += "</ul>";
			$("#dImgPreView").html(ImgPreStr);
			
		});
	});
	
</script>
</head>
<body>
	<div>文件上传</div>
	<div>
		<div>
			<div>
				图片：
				<div id="dImgPreView"></div>
				<br />
			</div>
			<div id="divUpdRes"></div>
			<div>
				<input type="file" id="TSK_ATT" multiple="multiple" class="cFilUpd">
			</div>
			<div>
				<input type="button" id="bImgUpd" value='上传'>
			</div>
		</div>

	</div>

	<input type="text" id="word_type" style="display: none;" value=""
		name="word_type" />
	</br>


</body>
</html>